Skip to content

test(r13): evaluator matrix and clause-level corpus cases (R13 slice 1) - #83

Merged
TimelordUK merged 2 commits into
mainfrom
test/r13-slice1-evaluator-matrix
Sep 13, 2026
Merged

TimelordUK merged 2 commits into
mainfrom
test/r13-slice1-evaluator-matrix

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

R13 slice 1: pin every divergence between the two expression evaluators before changing either. No engine change. Parity AGREE is unchanged at 168; cases go from 197 to 203.

The matrix

tests/evaluator_matrix_tests.rs runs 36 predicates through both evaluators:

  • RecursiveWhereEvaluator, as WHERE <predicate>
  • ArithmeticEvaluator, as SELECT (<predicate>)

The table has five rows, with NULL in every operand position. Each row's answer is compared with what DuckDB returns for the same table; the expected strings were generated, not derived by hand.

Agrees with SQL
WHERE evaluator 36 / 36
Value evaluator (SELECT, HAVING, joins) 4 / 36

The 32 divergences are recorded in KNOWN, grouped by fault:

Fault Entries
Comparisons: NULL vs value is false, NULL vs NULL is equal 11
NOT negates that false to true 3
IN / NOT IN two-valued, NULL matches NULL 6
BETWEEN two-valued 4
LIKE false for NULL 2
AND / OR collapse through to_bool 6

It uses the corpus contract. A recorded divergence that changes, including being fixed, fails the test (checked by breaking an entry on purpose). So slice 2 has to update this file to prove what it moved.

Corpus: the user-visible forms

Case Finding Bucket
select_eq_null_literal: score = NULL is TRUE for NULL rows P48 (P18 live outside WHERE) DIFFER
select_in_list_with_null P48 DIFFER
select_and_with_null P48 DIFFER
having_not_over_null: an all-NULL group is kept under NOT P50 DIFFER
select_and_unparenthesised: SELECT a AND b does not parse P51 GAP
join_on_null_key_both_sides: 32 rows vs 7 P52 DIFFER

Docs

  • P48 widened to the whole value evaluator.
  • P50–P52 filed. P52 records that both join paths pair NULL keys: the hash path uses NULL as a HashMap key, and the nested-loop path uses compare_with_op.
  • R13 marked in progress, with the base decision: the value evaluator's shape carries the WHERE evaluator's rules. Slice 2's acceptance test is now concrete: every value-evaluator KNOWN entry disappears, and the corpus moves by exactly the P48/P50 cases.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GpuTexUeuyuAdmDsukMTRW

TimelordUK and others added 2 commits September 13, 2026 16:25
No engine change. tests/evaluator_matrix_tests.rs runs 36 predicates through
both evaluators - RecursiveWhereEvaluator as WHERE, ArithmeticEvaluator as a
SELECT item - over a five-row table with NULL in every operand position, and
compares each row with the three-valued answer DuckDB gives for the same table.

WHERE evaluator: 36/36. Value evaluator: 4/36. The 32 divergences are recorded
in KNOWN, grouped by fault (comparison, NOT, IN, BETWEEN, LIKE, AND/OR), under
the corpus contract: a recorded divergence that changes - including being
fixed - fails the test, so slice 2 must update the file to prove what it moved.

Six corpus cases pin the user-visible forms: SELECT `= NULL`, IN with NULL, AND
with NULL (P48); HAVING NOT over an all-NULL group (P50); unparenthesised AND
in a SELECT item (P51, GAP); a join on NULL keys on both sides (P52).
Parity AGREE unchanged at 168; 197 -> 203 cases.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GpuTexUeuyuAdmDsukMTRW
P48 now covers the whole value evaluator: six faults, including NULL = NULL
comparing equal (P18, still live outside WHERE). P50 HAVING admits a group
whose predicate is UNKNOWN under NOT. P51 AND/OR not accepted in a SELECT item
unless parenthesised. P52 a join on NULL keys pairs NULL rows, on both the hash
and nested-loop paths.

R13 marked in progress with slice 1 done, its result, and the base decision:
the value evaluator's shape carries the WHERE evaluator's rules.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GpuTexUeuyuAdmDsukMTRW
@TimelordUK
TimelordUK merged commit 5cd6e7d into main Sep 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant